﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Mechanics.GameEventMechanics {
    import Mechanics.GameMechanicInterfaces.*;
    import Mechanics.*;
    import flash.utils.*;
    import Classes.*;
    import Display.*;
    import Display.MarketUI.*;
    import Modules.malls.ui.*;

    public class CatalogGenerationMechanic implements ICatalogGenerationMechanic, IMultiPickSupporter, IToolTipModifier {

        private static var catalogs:Array = [MallCatalogUI];

        protected var m_owner:MechanicMapResource;
        protected var m_config:MechanicConfigData;

        public function hasOverrideForGameAction(_arg1:String):Boolean{
            return (true);
        }
        public function initialize(_arg1:IMechanicUser, _arg2:MechanicConfigData):void{
            this.m_owner = (_arg1 as MechanicMapResource);
            this.m_config = _arg2;
        }
        public function isVisitEnabled():Boolean{
            return (false);
        }
        public function executeOverrideForGameEvent(_arg1:String, _arg2:Array=null):MechanicActionResult{
            var _local5:String;
            var _local6:ItemCatalogUI;
            var _local7:TabbedCatalogUI;
            var _local8:String;
            var _local9:String;
            var _local10:int;
            var _local11:Array;
            var _local12:String;
            var _local13:Boolean;
            var _local14:Boolean;
            var _local15:String;
            var _local16:String;
            var _local17:Boolean;
            var _local18:String;
            var _local19:Boolean;
            var _local20:Boolean;
            var _local21:Boolean;
            var _local3:Boolean;
            var _local4:Boolean;
            if (this.canPopCatalog()){
                if ("true" == this.m_config.params["blockOthers"]){
                    _local4 = true;
                };
                _local5 = this.m_config.params["style"];
                _local6 = this.makeCatalog();
                if (_local5 == "tabbed"){
                    _local7 = (_local6 as TabbedCatalogUI);
                    _local8 = this.m_config.params["catalogType"];
                    _local9 = this.m_config.params["itemName"];
                    _local10 = this.m_config.params["numTabs"];
                    _local7.numTabs = _local10;
                    _local11 = ((_local7.categoryNames)!=null) ? _local7.categoryNames : null;
                    _local12 = (((!((_local7.overrideTitle == null))) && (!((_local7.overrideTitle == ""))))) ? _local7.overrideTitle : "";
                    _local13 = false;
                    _local14 = false;
                    UI.clearTabbedCatalog();
                    UI.displayTabbedCatalog(_local7, _local8, _local9, _local11, _local12, _local13, _local14);
                } else {
                    _local15 = this.m_config.params["catalogType"];
                    _local16 = this.m_config.params["itemName"];
                    _local17 = false;
                    _local18 = this.m_config.params["overrideTitle"];
                    _local19 = false;
                    _local20 = false;
                    _local21 = false;
                    UI.displayCatalog(_local15, _local16, _local17, _local18, _local19, _local20, _local21);
                };
                _local3 = true;
            };
            return (new MechanicActionResult(_local3, !(_local4), false));
        }
        public function canPopCatalog():Boolean{
            return (!((((this.m_owner is HarvestableResource)) && ((this.m_owner as HarvestableResource).isHarvestable()))));
        }
        protected function makeCatalog():ItemCatalogUI{
            var _local1:Class = (getDefinitionByName(this.m_config.params["catalogUI"]) as Class);
            return (new _local1(this.m_owner));
        }
        public function getPick():String{
            return (this.m_config.params["pick"]);
        }
        public function getToolTipStatus():String{
            var _local1:String;
            return (_local1);
        }
        public function getToolTipAction():String{
            var _local1:String = ZLoc.t("Items", "warehouse_defaultToolTip");
            return (_local1);
        }

    }
}//package Mechanics.GameEventMechanics 
